import java.util.*;

/**
 * @author: LouLunjian
 * @date: 2022/3/10
 * @description:
 */
public class test {
    public static void main(String[] args) {
        boolean s1=Valid("([{}])");
        System.out.println(s1);

    }
    //栈匹配括号
    public static boolean Valid(String s) {
        //声明一个栈
        Stack<Character> stack =new Stack<>();
        //for循环遍历字符
        for(int i=0;i<s.length();i++) {
            char c =s.charAt(i);
            //返回指定索引处的 char 值。
            /**
             * if判断 为左边括号，如果是则入栈
             * 如果不是则输出flase
             */
            if(c=='('||c=='['||c=='{') {
                stack.push(c);
                continue;//进入下次循环，取出下一个字符
            }
            if(stack.empty()) {
                //如果字符不是左边括号，并且为空 输出false
                return false;
            }
            //判断c是否为右括号，如果是就取栈顶元素对比
            char top = stack.pop();
            //pop即可以return出栈顶元素,也可以出栈
            //利用泛型
            if (top == '(' && c == ')') {
                continue;
            }
            if (top == '[' && c == ']') {
                continue;
            }
            if (top == '{' && c == '}') {
                continue;
            }
            return false;
        }
        //查看栈是否为空
        if(stack.empty()) {
            return true;
        }
        return false;
    }

    public static int gossip(int n) {
        if (n == 1 || n == 2 || n == 0) {
            return 1;
        } else {
            return gossip(n - 1) + gossip(n - 2);
        }
    }



    //两个字符串相互包含（四达旧手机）
    public void  strcontain(){
        Scanner input = new Scanner(System.in);
        String in = input.next();
        char[] ch_in = in.toCharArray();
        Scanner output = new Scanner(System.in);
        String out = output.next();
        char[] ch_out = out.toCharArray();
        int i = 0;
        int j = 0;
        String result = "";
        while(j<ch_in.length){
            if(ch_out[i] != ch_in[j]){
                if(!result.contains(String.valueOf(ch_in[j]))){
                    result = result+ch_in[j];
                    j++;
                }

                while (ch_out[i] != ch_in[j]){
                    if(!result.contains(String.valueOf(ch_in[j]))){
                        System.out.println("j = " + j);
                        result = result+ch_in[j];
                    }
                    j++;
                }
            }
            i++;
            j++;
        }
        System.out.print("result="+result);
    }
    public void styt(){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();//学生人数
        int p = sc.nextInt();//平时分占比
        int q = sc.nextInt();//期末分占比
        Integer[] grade = new Integer[n];
        //学生期末分
        for (int i = 0; i < n; i++) {
            grade[i] = sc.nextInt();
        }
        Arrays.sort(grade, Collections.reverseOrder());
        //存放学生的最终成绩
        double[] result = new double[n];
        int count = 0;//及格人数
        for (int i = 0; i < n; i++) {
                result[i] = (double)(100 * p + grade[i] * q) / 100;
            if (result[i] >= 60) {
                count++;
            }
        }
        System.out.println(count);
    }

}
